<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function computed(str) {
            
            console.log(str.split(" ")); 
          
            let arr = str.split(" ");
      
            arr.reverse();
       
            console.log(arr);
            
            let newArr = arr[1].split("");
            console.log(newArr);
   
            var sum = "";
          
            for (let i = 1; i < newArr.length; i++) {
                sum += newArr[i];
            }
            console.log(arr[1].split("")[0].toUpperCase() + sum);//World
            arr[1] = arr[1].split("")[0].toUpperCase() + sum;
        
            let newArr2 = arr[2].split("");
            var sum2 = "";
            for (let i = 1; i < newArr2.length; i++) {
                sum2 += newArr2[i];
            }
            console.log(arr[2].split("")[0].toUpperCase() + sum2);
            arr[2] = arr[2].split("")[0].toUpperCase() + sum2;
            arr.join("");
            console.log(arr);
            var newarr2 = arr.map((item, index) => {
                return item.split("").reverse();
            });
            console.log(newarr2);
            let newArr3 = [];
            newarr2.forEach((item, index) => {
                newArr3.push(item.join("").trim());
            });

            console.log(newArr3.join("").replace("！", "啊"))
        }
        computed("hello world 我爱你！");
    </script>
</body>

</html>